<script>
    // 对象的解构赋值
    // 注意：1.解构一个不存在的属性会得到undefined
    //       2. {属性名：别名，属性，属性=默认值}

    const obj = { name: "周杰伦", age: 35 };
    console.log(obj.name);
    console.log(obj.age);

    let age = 45;
    let { age: zjlage, name, email = "zjl@qq.com" } = obj;
    console.log(name);
    console.log(age);   //45
    console.log(zjlage);    //35
    console.log(email);


    // 数组的解构赋值
    const pigFamily = ['猪爸爸', '猪妈妈', '佩奇', '乔治'];
    let [fathyer, mother, , child] = pigFamily;
    console.log(fathyer, mother, child);

</script>